<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>添加商品</title>
	<style>
		#app {
			margin: 20px;
			padding: 20px;
			border: 1px solid #ccc;
			border-radius: 5px;
			background-color: #f9f9f9;
			width:950px;
		}
		label {
			display: block;
			margin-bottom: 10px;
			font-weight: bold;
		}
		input[type="text"], select {
			display: block;
			margin-bottom: 10px;
			padding: 5px;
			border: 1px solid #ccc;
			border-radius: 3px;
			width: 100%;
			box-sizing: border-box;
		}
		input[type="button"] {
			background-color: #fbc2eb;
			color: white;
			padding: 10px 20px;
			border: none;
			border-radius: 3px;
			cursor: pointer;
		}
		input[type="button"]:hover {
			background-color: rgb(255, 128, 192);
		}
	</style>
	<script type="text/javascript" src="js/vue-2.6.10.js"></script>
  	<script type="text/javascript" src="js/axios.js"></script>
</head>
<body>
	<div id="app">
				<input type="hidden" v-model='commod.cNumber' name="cNumber">
				<label for="commod_name">商品名称：</label>
				<input type="text" id="commod_name" name="commod_name" v-model='commod.cName' name="cName" ><br>
				<label for="commod_name">商品编号：</label>
				<input type="text" id="commod_number" name="commod_number" v-model='commod.cNumber' name="cNumber" ><br>
				<label for="commod_price">价  格：</label>
				<input type="text" id="commod_price" name="commod_price" v-model='commod.cPrice' name="cPrice" ><br>
				<label for="commod_inventory">库  存：</label>
				<input type="text" id="commod_inventory" name="commod_inventory" v-model='commod.cInventory' name="inventory" ><br>
				<input type="button" value="完成" @click="addCommod">
	</div>
	<script type="text/javascript">
	

  	  let vue = new Vue({
  		  el:'#app',
  		  data:{
  			  commod:{
  				  cPrice:'',
  				  cInventory:'',
  				  cNumber:'',
  				  cName:'',

  			  }
  		  },
  		  created(){
  			  
  			  
  		  },
  		  methods: {
  			  addCommod: function(){
  				param = "cName="+vue.commod.cName +"&cNumber="+vue.commod.cNumber+"&cPrice="+vue.commod.cPrice+"&cInventory="+vue.commod.cInventory;
  				axios.post('/OrderServert/emp.do?'+param).then(
	  				function(res_obj){
	  					//vue.commod = res_obj.data.data;
	  					//console.log(res_obj.data.data.rows);
	  					//console.log(vue.commod);
	  					window.location.href="commod.html";
	  				}	  
	  			  ).catch(
							function(error_obj){
								alert("数据加载异常！！！");
							}
					)
  			  }
  			  
  		  }
  	  });
  
  </script>
</body>
</html>